<template>
	<view class="SongSheetItem">
		<u-navbar :title="songSheetItem.sheetName" back-icon-color="#fff" :background="background" title-color="#fff"></u-navbar>
		<view class="u-page">
			<view class="content">
				<view class="banner">
					<cover-image :src="songSheetItem.imgUrl" class="bannerImg"></cover-image>
				</view>
				<view class="listBox">
					<view class="listItem" v-for="(item, index) in songSheetItem.songVO" :key="item.musicId" @click="goPlay(item, index)">
						<view class="left">
							<view class="detail">
								<view class="songTitle">
									{{item.musicName}}
								</view>
							</view>
						</view>
						<view class="right">
							<u-icon name="arrow-" custom-prefix="custom-icon" color="#999"></u-icon>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import { mapState, mapMutations } from "vuex"
	export default {
		data() {
			return {
				background: {},
				title: "",
				imgUrl: "",
				// songList: [],
			}
		},
		computed: {
			...mapState({
				list:({config})=>config.tabBarList,
				commonColor: ({config})=>config.commonColor,
				songSheetItem: ({config}) => config.songSheetItem,
			})
		},
		methods: {
			...mapMutations({
				SET_List: "config/SET_List",
				SET_index: "config/SET_index",
			}),
			goPlay(item, index) {
				this.SET_List(this.songSheetItem.songVO);
				this.SET_index(index);
				this.$Router.push({
					name: 'player'
				})
			}
		},
		created() {
			this.background["backgroundColor"] = this.commonColor;
		},
		onLoad() {
			// const {sheetName, imgUrl, songVO} = this.$Route.query;
			// this.title = sheetName;
			// this.imgUrl  = imgUrl;
			// this.songList = songVO;
			// console.log(this.songList);
		}
	}
</script>

<style lang="less" scoped>
.SongSheetItem {
	display: flex;
	flex-direction: column;
	height: 100%;
	.u-page {
		flex: 1;
		// overflow: hidden;
		padding: 20rpx;
		.content {
			background-color: #fff;
			padding: 20rpx;
			.banner {
				.bannerImg {
					height: 250rpx;
					border-radius: 10rpx;
				}
			}
			.listBox {
				.listItem {
					display: flex;
					align-items: center;
					justify-content: space-between;
					padding: 20rpx 0;
					.left {
						display: flex;
						align-items: center;
						.rank {
							font-size: 35rpx;
							color: #df3436;
						}
						.detail {
							padding-left: 20rpx;
							.songTitle {
								font-size: 30rpx;
								letter-spacing: 8rpx;
								padding: 10rpx 0;
							}
							.author {
								font-size: 20rpx;
								color: #666;
							}
						}
					}
					.right {
						font-size: 35rpx;
					}
				}
			}
		}
	}
}
</style>
